<template>
  <div ref="charts" class="charts"></div>
</template>

<script>
import * as echarts from 'echarts'
import resize from '@/mixins/resize'

export default {
  name: 'ProgressChart',
  moixins: [resize],
  mounted() {
    const myEcharts = echarts.init(this.$refs.charts)
    myEcharts.setOption({
      grid: {
        left: 0,
        right: 0
      },
      xAxis: {
        min: 0,
        max: 100,
        show: false
      },
      yAxis: {
        show: false,
        // 调换x y轴
        type: 'category'
      },
      series: {
        type: 'bar',
        data: [89],
        // 柱状条的宽度
        barWidth: 20,
        // 柱状条的颜色
        showBackground: true,
        // 柱状条样式
        itemStyle: {
          // 颜色
          color: 'pink'
        },
        // 显示的内容
        label: {
          show: true,
          formatter: '|',
          color: 'pink',
          // 位置
          possition: 'right'
        }
      }
    })
    this.myEcharts = myEcharts
  },
}
</script>

<style lang="sass" scoped>
.charts
  width: 100%
  height: 100%
</style>